<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

use think\facade\Route;

Route::any('/', '@index/index/index');

Route::group('api', function (){
    //system 模块
    Route::group('system', function (){
        //system login 模块
        Route::post('login', 'system/login/login');
        Route::get('logout', 'system/login/logout');

        //system admin模块
        Route::group('admin', function (){
            //admin 列表
            Route::get('/', 'index');
            Route::post('add', 'add');
            Route::post('edit', 'edit');
            Route::post('del', 'del');
            Route::post('change_status', 'changeStatus');
            //使用 prefix 简化控制器路由地址
        })->prefix('system/admin/');


        //system role模块
        Route::group('role', function (){
            //admin 列表
            Route::get('/', 'index');
            Route::post('add', 'add');
            Route::post('edit', 'edit');
            Route::post('del', 'del');
            Route::post('change_status', 'changeStatus');
            Route::get('getNodesByRoleId', 'getNodesByRoleId');
            Route::post('role_authorize', 'role_authorize');
            //使用 prefix 简化控制器路由地址
        })->prefix('system/Role/');

        //system menu模块
        Route::group('menu', function (){
            Route::get('/', 'index');
            Route::get('getNodeByRouter', 'getNodeByRouter');
            Route::post('add', 'add');
            Route::post('edit', 'edit');
            Route::post('del', 'del');
            Route::post('change_status', 'change_status');
        })->prefix('system/menu/');

    });
    //配置跨域
})->allowCrossDomain()
    //基础权限中间件拦截
    ->middleware(\app\http\middleware\Base::class);
